package LeetCode;

/**
 * @Classname LC814
 * @Description // https://leetcode-cn.com/problems/binary-tree-pruning/ 树 经典 后续遍历 访问到之后再修改
 * @Date 2021/4/21 21:04
 * @Created by yin
 */
public class LC814 {
    public TreeNode pruneTree(TreeNode root) {
        if(root == null) {
            return null;
        }
        root.left = pruneTree(root.left);
        root.right = pruneTree(root.right);
        if(root.left == null && root.right == null && root.val == 0) {
            return null;
        }
        return root;
    }

}
